﻿{% extends "base.html" %}

{% block scripts %}
{% endblock %}

{% block content %}
    <h1>Витрина</h1>
    <div class="user_cabinet_base">
        <div class="panel_1">
        <ul class="profile_options">
        <li class="option_item"><a href="/company/{{ company.id }}/"> Вернуться к компании</a></li>
        {% if request.user == company.owner %}
        <li class="option_item"><a href="/add_good/{{ company.id }}/"> Добавить товар</a></li>
        {% endif %}
        </ul>
        </div>
    </div>
<!--
<li class="item"><a href="/showcase/{{ company.id }}/{{ goods.previous_page_number }}/"><img class="icon" src="/media/images/icon_arrow_2.gif" width="11" height="5"></a></li>
<li class="item"><a href="/showcase/{{ company.id }}/{{ goods.next_page_number }}/"><img class="icon" src="/media/images/icon_arrow_1.gif" width="11" height="5"></a></li>
-->


    {% if goods.object_list %}
    <ul class="paging">
        {% if goods.has_previous %}
            <li class="item"><a href="/showcase/{{ company.id }}/{{ goods.previous_page_number }}/"><img class="icon" src="/media/images/icon_arrow_2.gif" width="11" height="5"></a></li>
        {% endif %}
        {% for page in goods.paginator.page_range %}
            {% if page == goods.number %}
                <li class="item item_current">{{ page }}</li>
            {% else %}
                <li class="item"><a href="/showcase/{{ company.id }}/{{ page }}/">{{ page }}</a></li>
            {% endif %}
        {% endfor %}
        {% if goods.has_next %}
           <li class="item"><a href="/showcase/{{ company.id }}/{{ goods.next_page_number }}/"><img class="icon" src="/media/images/icon_arrow_1.gif" width="11" height="5"></a></li>
        {% endif %}
    </ul>
    {% endif %}

    <ul class="showcase_list">
        {% for good in goods.object_list %}
        <li class="list_item">
            <div class="pic">
                <span class="pic_in">
                     <img
                         {% if good.image %}
                            src="{{ good.image.url }}"
                            {% if good.image.width > good.image.height %} width="84" {% else %} height="84" {% endif %}
                         {% else %}
                            src="/media/images/img_no.gif" width="84" height="84"
                         {% endif %}
                     />
                </span>
            </div>
            <div class="name">
                <a class="showcase" title="{{ good.name }} {{ good.price }} p" href="{% if good.image %}{{ good.image.url }}{% else %}/media/images/img_no.gif{% endif %}">{{ good.name }}</a>
            </div>
            <div class="price">{{ good.price }} р</div>
            {% if request.user == good.company.owner %}
            <a href="/edit_good/{{ good.id }}/">Редактировать товар</a>
            {% endif %}
        </li>
        {% endfor %}
    </ul>

    {% if goods.object_list %}
     <ul class="paging">
        {% if goods.has_previous %}
            <li class="item"><a href="/showcase/{{ company.id }}/{{ goods.previous_page_number }}/"><img class="icon" src="/media/images/icon_arrow_2.gif" width="11" height="5"></a></li>
            <!--<li сlass="item"><a href="/showcase/{{ company.id }}/{{ goods.previous_page_number }}/"><img class="icon" src="/media/images/icon_arrow_2.gif" width="11" height="5"></a></li>-->
        {% endif %}
        {% for page in goods.paginator.page_range %}
            {% if page == goods.number %}
                <li class="item item_current">{{ page }}</li>
            {% else %}
                <li class="item"><a href="/showcase/{{ company.id }}/{{ page }}/">{{ page }}</a></li>
            {% endif %}
        {% endfor %}
        {% if goods.has_next %}
           <li class="item"><a href="/showcase/{{ company.id }}/{{ goods.next_page_number }}/"><img class="icon" src="/media/images/icon_arrow_1.gif" width="11" height="5"></a></li>
        {% endif %}
    </ul>
    {% endif %}

{% endblock %}